<%@ page import="com.xinjie.www.service.tieba.TiebaServiceImpl" %>
<%@ page import="com.xinjie.www.po.Tieba" %>
<%@ page import="java.util.List" %>
<%@ page import="com.xinjie.www.util.Constants" %>
<%@ page import="com.xinjie.www.po.Manager" %>
<%@ page import="java.sql.SQLException" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>查看自己管理的贴吧</title>
    <style type="text/css">
        table {
            width: 100%;
            border: 1px solid red;
            border-collapse: collapse;
        }

        th, td {
            border: 1px solid red;
        }
    </style>
</head>
<body>
<%
    Object o = request.getSession().getAttribute(Constants.MANAGER_SESSION);
    Manager manager = (Manager) o;
    TiebaServiceImpl tiebaService = new TiebaServiceImpl();
    List<Tieba> tiebas = null;
    try {
        tiebas = tiebaService.getOwnTieba(manager.getName());
    } catch (SQLException | ClassNotFoundException e) {
        e.printStackTrace();
    }
%>
<div align="center">
    <h4>管理的贴吧</h4>
    <table>
        <tr>
            <th>贴吧id</th>
            <th>贴吧名</th>
            <th>贴吧简介</th>
            <th>贴吧创建时间</th>
            <th>帖子数</th>
            <th>所有评论</th>
            <th>被封禁用户</th>
            <th>待处理的举报帖子</th>
        </tr>
        <%
            for (Tieba tieba : tiebas) {
        %>
        <tr>
            <%= "<td>" + tieba.getTiebaId() + "</td>"%>
            <%="<td>" + tieba.getName() + "</td>"%>
            <%="<td>" + tieba.getIntroduce() + "</td>"%>
            <%="<td>" + tieba.getTime() + "</td>"%>
            <%="<td>" + tieba.getPostNum() + "</td>"%>
            <%
                int id = tieba.getTiebaId();
                String name = tieba.getName();
            %>
            <td><a href="ManagerComment.jsp?tieba1=<%=name%>">查看</a> </td>
            <td><a href="LookBanUser.jsp?id=<%=id%>" >查看</a> </td>
            <td><a href="LookReport.jsp?tieba=<%=name%>">查看</a> </td>
        </tr>
        <%}%>
    </table>
    <a href="ManagerFrame.jsp">返回</a>
</div>
</body>
</html>
